import React, {Component} from 'react';

export class AlertInfo extends Component {
    constructor(props) {
        super(props)
        this.state = {
            showalert:{display:"none"}
        }
    }
    componentWillReceiveProps(nextProps) {
        if (nextProps.info) {
            this.setState({
                showalert:{display:"block"}
            })
            setTimeout(()=>{
                this.setState({
                    showalert:{display:"none"}
                })
            },1500)
        }
    }
    render() {
        return (
            <div className="modal-wrap" style={this.state.showalert}>
                <div className="modal-box-default">
                    {this.props.info}
                </div>
            </div>
        )
    }
}

